##xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# list(PREPEND CMAKE_PREFIX_PATH "${MY_THIRD_PARTY}/fmt/lib/cmake/fmt")
# list(PREPEND CMAKE_PREFIX_PATH "${MY_THIRD_PARTY}/spdlog/lib/cmake/spdlog")


##xxxxxxxxxxxxxxxxxxxxxxxxxxxxx fmt
find_package(fmt CONFIG REQUIRED)
# 打印 fmt 库的基本信息
message(STATUS "[MYFIND] fmt_VERSION: ${fmt_VERSION}")
# 打印 fmt::fmt 目标的详细信息
if(TARGET fmt::fmt AND FALSE)
    message(STATUS "[MYFIND] Target fmt::fmt exists")

    # 获取目标类型
    get_target_property(FMT_TARGET_TYPE fmt::fmt TYPE)
    message(STATUS "[MYFIND] fmt::fmt target type: ${FMT_TARGET_TYPE}")

    # 获取包含目录
    get_target_property(FMT_INCLUDE_DIRS fmt::fmt INTERFACE_INCLUDE_DIRECTORIES)
    message(STATUS "[MYFIND] fmt::fmt include directories: ${FMT_INCLUDE_DIRS}")

    # 获取链接库
    get_target_property(FMT_LINK_LIBRARIES fmt::fmt INTERFACE_LINK_LIBRARIES)
    message(STATUS "[MYFIND] fmt::fmt link libraries: ${FMT_LINK_LIBRARIES}")

    # 获取编译定义
    get_target_property(FMT_COMPILE_DEFINITIONS fmt::fmt INTERFACE_COMPILE_DEFINITIONS)
    message(STATUS "[MYFIND] fmt::fmt compile definitions: ${FMT_COMPILE_DEFINITIONS}")

    # 获取编译选项
    get_target_property(FMT_COMPILE_OPTIONS fmt::fmt INTERFACE_COMPILE_OPTIONS)
    message(STATUS "[MYFIND] fmt::fmt compile options: ${FMT_COMPILE_OPTIONS}")
else()
    message(STATUS "[MYFIND] skip print, target fmt::fmt vars")
endif()


##xxxxxxxxxxxxxxxxxxxxxxxxxxxxx spdlog
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
find_package(spdlog CONFIG REQUIRED)

# 打印 spdlog 库的基本信息
if(TARGET spdlog::spdlog AND FALSE)
    message(STATUS "[MYFIND] Target spdlog::spdlog exists")

    # 获取目标类型
    get_target_property(SPDLOG_TARGET_TYPE spdlog::spdlog TYPE)
    message(STATUS "[MYFIND] spdlog::spdlog target type: ${SPDLOG_TARGET_TYPE}")

    # 获取包含目录
    get_target_property(SPDLOG_INCLUDE_DIRS spdlog::spdlog INTERFACE_INCLUDE_DIRECTORIES)
    message(STATUS "[MYFIND] spdlog::spdlog include directories: ${SPDLOG_INCLUDE_DIRS}")

    # 获取链接库
    get_target_property(SPDLOG_LINK_LIBRARIES spdlog::spdlog INTERFACE_LINK_LIBRARIES)
    message(STATUS "[MYFIND] spdlog::spdlog link libraries: ${SPDLOG_LINK_LIBRARIES}")

    # 获取编译定义
    get_target_property(SPDLOG_COMPILE_DEFINITIONS spdlog::spdlog INTERFACE_COMPILE_DEFINITIONS)
    message(STATUS "[MYFIND] spdlog::spdlog compile definitions: ${SPDLOG_COMPILE_DEFINITIONS}")

    # 获取编译选项
    get_target_property(SPDLOG_COMPILE_OPTIONS spdlog::spdlog INTERFACE_COMPILE_OPTIONS)
    message(STATUS "[MYFIND] spdlog::spdlog compile options: ${SPDLOG_COMPILE_OPTIONS}")
else()
    message(STATUS "[MYFIND] skip print, target spdlog::spdlog vars")
endif()


##xxxxxxxxxxxxxxxxxxxxxxxxxxxxx cuda
if(FALSE)
    find_package(CUDAToolkit REQUIRED)
endif()

# 打印 CUDA 的基本信息
if(CMAKE_CUDA_COMPILER AND FALSE)
    message(STATUS "[MYFIND] CUDA compiler found: ${CMAKE_CUDA_COMPILER}")
    message(STATUS "[MYFIND] CUDA toolkit directory: ${CMAKE_CUDA_TOOLKIT_ROOT_DIR}")
    message(STATUS "[MYFIND] CUDA include directories: ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}")
    message(STATUS "[MYFIND] CUDA host compiler: ${CMAKE_CUDA_HOST_COMPILER}")
    message(STATUS "[MYFIND] CUDA standard libraries: ${CMAKE_CUDA_STANDARD_LIBRARIES}")

    # 获取 CUDA 版本信息
    if(DEFINED CMAKE_CUDA_COMPILER_VERSION)
        message(STATUS "[MYFIND] CUDA compiler version: ${CMAKE_CUDA_COMPILER_VERSION}")
    endif()

    # 获取 CUDA 架构信息
    if(DEFINED CMAKE_CUDA_ARCHITECTURES)
        message(STATUS "[MYFIND] CUDA architectures: ${CMAKE_CUDA_ARCHITECTURES}")
    endif()

    # 打印 CUDA 库信息
    message(STATUS "[MYFIND] CUDA_LIBRARIES: ${CUDA_LIBRARIES}")

    # 检查特定 CUDA 库
    if(DEFINED CUDA_cudart_LIBRARY)
        message(STATUS "[MYFIND] CUDA cudart library: ${CUDA_cudart_LIBRARY}")
    endif()

    if(DEFINED CUDA_cublas_LIBRARY)
        message(STATUS "[MYFIND] CUDA cublas library: ${CUDA_cublas_LIBRARY}")
    endif()

    if(DEFINED CUDA_cufft_LIBRARY)
        message(STATUS "[MYFIND] CUDA cufft library: ${CUDA_cufft_LIBRARY}")
    endif()

    if(DEFINED CUDA_cufft64_LIBRARY)
        message(STATUS "[MYFIND] CUDA cufft64 library: ${CUDA_cufft64_LIBRARY}")
    endif()

    # 打印所有 CUDA 相关的变量
    if(FALSE)
        get_cmake_property(VAR_NAMES VARIABLES)
        foreach(VAR_NAME ${VAR_NAMES})
            if(VAR_NAME MATCHES "^CUDA_")
                message(STATUS "[MYFIND] CUDA variable ${VAR_NAME}: ${${VAR_NAME}}")
            endif()
        endforeach()
    endif()

else()
    message(STATUS "[MYFIND] skip print CUDA")
endif()
